import { reqShopCart } from "@/api"
const state={
    cartList:{}
}
const actions = {
    async toShopCart(context){
        const result = await reqShopCart()
        // console.log(result,'shopcart--action');
        context.commit('TOSHOPCART',result.data)
    }
}
const mutations = {
    TOSHOPCART(state,data){
        state.cartList = data[0]
        // console.log(state.cartList,'shopcart--mutation');
    }
}
const getters = {
    cartInfoList(state){
        try {
            return state.cartList.cartInfoList || []
        } catch (error) {
            return []
        }
        
    }
}
export default {
    state,
    actions,
    mutations,
    getters
}